import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;

public class Actor
{
	protected int angulo;
	protected int x, y;
	protected int ancho, alto;
	protected String estado;
	protected String spriteName;
	protected Escenario escenario;
	protected SpriteCache spriteCache;

	public Actor(Escenario escenario)
	{
		this.escenario = escenario;
		spriteCache = escenario.getSpriteCache();
	}

	public void mostrar(Graphics2D g)
	{
		Graphics2D graphics = (Graphics2D) g;
		AffineTransform affineTransform = new AffineTransform();
		int ancho = spriteCache.getSprite(spriteName).getWidth(escenario);
		int alto = spriteCache.getSprite(spriteName).getHeight(escenario);
		affineTransform.translate(this.x, this.y);
		affineTransform.translate((ancho / 2), (alto / 2));
		affineTransform.rotate(Math.toRadians(this.angulo));
		affineTransform.translate(-(ancho / 2), -(alto / 2));
		graphics.drawImage(spriteCache.getSprite(spriteName), affineTransform, escenario);
	}

	public int getAngulo()
	{
		return this.angulo;
	}

	public void setAngulo(int angulo)
	{
		this.angulo = angulo;
	}

	public int getX()
	{
		return this.x;
	}

	public void setX(int x)
	{
		this.x = x;
	}

	public int getY()
	{
		return this.y;
	}

	public void setY(int y)
	{
		this.y = y;
	}

	public String getSpriteName()
	{
		return spriteName;
	}

	public void setSpriteName(String string)
	{
		spriteName = string;
		BufferedImage image = spriteCache.getSprite(spriteName);
		alto = image.getHeight();
		ancho = image.getWidth();
	}

	public int getAlto()
	{
		return alto;
	}

	public void setAlto(int alto)
	{
		this.alto = alto;
	}

	public int getAncho()
	{
		return ancho;
	}

	public void setAncho(int ancho)
	{
		this.ancho = ancho;
	}

	public void setEstado(String e)
	{
		estado = e;
	}

	public String getEstado()
	{
		return estado;
	}

	public void actuar(DatosActor da)
	{
	}
	
}
